package appapi.service.impl;

import appapi.Vo.brider.SceneDevicePageVo;
import appapi.common.PageReq;
import appapi.dto.bridge.CheckDeviceDto;
import appapi.dto.bridge.FaceRecordDto;
import appapi.entity.bridge.EquipmentEntity;
import appapi.entity.bridge.SceneDeviceEntity;
import appapi.service.mango.SceneDeviceService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import appapi.dao.SceneDeviceMapper;

import java.util.List;
import java.util.Map;

/**
 * @author dhq
 * @date 2023/9/12  9:54
 * @version 1.0
 */
@Service
public class SceneDeviceServiceImpl implements SceneDeviceService {

    @Resource
    private SceneDeviceMapper sceneDeviceMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return sceneDeviceMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SceneDeviceEntity record) {
        return sceneDeviceMapper.insert(record);
    }

    @Override
    public int insertSelective(SceneDeviceEntity record) {
        return sceneDeviceMapper.insertSelective(record);
    }

    @Override
    public SceneDeviceEntity selectByPrimaryKey(Long id) {
        return sceneDeviceMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SceneDeviceEntity record) {
        return sceneDeviceMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SceneDeviceEntity record) {
        return sceneDeviceMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<CheckDeviceDto> getUnBindDevice(Long projId, Integer deviceType) {
        if(deviceType==6)
        {
            return sceneDeviceMapper.selectUnBindCamera(projId);
        }else if(deviceType==5)
        {
            return sceneDeviceMapper.selectUnBindPark(projId);
        }else if(deviceType==4)
        {
            return sceneDeviceMapper.selectUnBindDoor(projId);
        }else {
            return sceneDeviceMapper.selectUnBindDevice(projId, deviceType);
        }
    }

    @Override
    public List<SceneDevicePageVo> getSceneDeviceList(PageReq pageReq,Long secId) {
        PageHelper.startPage(pageReq.getCurrPage(), pageReq.getPageSize());
        return sceneDeviceMapper.getSceneDeviceList(secId);
    }


}
